# import win32com.client

# speaker = win32com.client.Dispatch("SAPI.SpVoice")
# speaker.Speak("你的手机号19983297340,一天什么时候最安全？中午，因为早晚会出事...，多少元123元，hello，剩余11.23元")

# -*- coding: utf-8 -*-
import pyttsx3
import hashlib #md5

data = '你好，小和；你的QQ496631085'
md5 = hashlib.md5(data.encode(encoding='UTF-8')).hexdigest()

engine = pyttsx3.init()
volume = engine.getProperty('volume')
engine.setProperty('volume', volume) #声音大小
# engine.say('The quick brown fox jumped over the lazy dog.')
engine.save_to_file(data , md5+'.mp3')
engine.runAndWait()

# voices = engine.getProperty('voices')
# for voice in voices:
#    engine.setProperty('voice', voice.id)
#    engine.say('你好，小何；你的手机号19983297340,一天什么时候最安全？中午，因为早晚会出事...，多少元123元，hello，剩余11.23元')
# engine.runAndWait()

# with open("all.txt",'r',encoding='utf-8') as f:
#   while 1:
#     line = f.readline()
#     print(line, end = '')
#     engine.say(line)
#     engine.runAndWait()